import pandas as pd

f2 = open('analysis2.txt','w',encoding='utf-8')
f = pd.read_csv('recruit_data.csv')
softWare = f[f['post'].str.contains('软件')].fillna('')
a = softWare['min_wages'].str.match(r'^\d+\.\d+$')
b = softWare['max_wages'].str.match(r'^\d+\.\d+$')
# c = f['min_wages'].str.match(r'^\d+\.\d+$').fillna(False)
# d = f['max_wages'].str.match(r'^\d+\.\d+$').fillna(False)
# f[c][d].to_csv('./data/recruit_data.csv',index=0)

minAns = softWare[a]['min_wages'].apply(lambda x: float(x)).mean()
maxAns = softWare[b]['max_wages'].apply(lambda x: float(x)).mean()
f2.write('平均最低薪资为:{},\n平均最高薪资为:{}。'.format(minAns,maxAns))
f2.close()
# print(softWare[softWare['min_wages'].str.len()>10]
